home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / lispref.info-17 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  50.7 KB  |  1,326 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo-1.63
  2. from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995
  12.  
  13.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  14. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  15. Copyright (C) 1995 Amdahl Corporation.  Copyright (C) 1995 Ben Wing.
  16.  
  17.    Permission is granted to make and distribute verbatim copies of this
  18. manual provided the copyright notice and this permission notice are
  19. preserved on all copies.
  20.  
  21.    Permission is granted to copy and distribute modified versions of
  22. this manual under the conditions for verbatim copying, provided that the
  23. entire resulting derived work is distributed under the terms of a
  24. permission notice identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that this permission notice may be stated in a
  29. translation approved by the Foundation.
  30.  
  31.    Permission is granted to copy and distribute modified versions of
  32. this manual under the conditions for verbatim copying, provided also
  33. that the section entitled "GNU General Public License" is included
  34. exactly as in the original, and provided that the entire resulting
  35. derived work is distributed under the terms of a permission notice
  36. identical to this one.
  37.  
  38.    Permission is granted to copy and distribute translations of this
  39. manual into another language, under the above conditions for modified
  40. versions, except that the section entitled "GNU General Public License"
  41. may be included in a translation approved by the Free Software
  42. Foundation instead of in the original English.
  43.  
  44. 
  45. File: lispref.info,  Node: Changing Key Bindings,  Next: Key Binding Commands,  Prev: Functions for Key Lookup,  Up: Keymaps
  46.  
  47. Changing Key Bindings
  48. =====================
  49.  
  50.    The way to rebind a key is to change its entry in a keymap.  If you
  51. change a binding in the global keymap, the change is effective in all
  52. buffers (though it has no direct effect in buffers that shadow the
  53. global binding with a local one).  If you change the current buffer's
  54. local map, that usually affects all buffers using the same major mode.
  55. The `global-set-key' and `local-set-key' functions are convenient
  56. interfaces for these operations (*note Key Binding Commands::.).  You
  57. can also use `define-key', a more general function; then you must
  58. specify explicitly the map to change.
  59.  
  60.    In writing the key sequence to rebind, it is good to use the special
  61. escape sequences for control and meta characters (*note String Type::.).
  62. The syntax `\C-' means that the following character is a control
  63. character and `\M-' means that the following character is a meta
  64. character.  Thus, the string `"\M-x"' is read as containing a single
  65. `M-x', `"\C-f"' is read as containing a single `C-f', and `"\M-\C-x"'
  66. and `"\C-\M-x"' are both read as containing a single `C-M-x'.  You can
  67. also use this escape syntax in vectors, as well as others that aren't
  68. allowed in strings; one example is `[?\C-\H-x home]'.  *Note Character
  69. Type::.
  70.  
  71.    The key definition and lookup functions accept an alternate syntax
  72. for event types in a key sequence that is a vector: you can use a list
  73. containing modifier names plus one base event (a character or function
  74. key name).  For example, `(control ?a)' is equivalent to `?\C-a' and
  75. `(hyper control left)' is equivalent to `C-H-left'.
  76.  
  77.    One advantage of using a list to represent the event type is that the
  78. precise numeric codes for the modifier bits don't appear in compiled
  79. files.
  80.  
  81.    For the functions below, an error is signaled if KEYMAP is not a
  82. keymap or if KEY is not a string or vector representing a key sequence.
  83. You can use event types (symbols) as shorthand for events that are
  84. lists.
  85.  
  86.  - Function: define-key KEYMAP KEY BINDING
  87.      This function sets the binding for KEY in KEYMAP.  (If KEY is more
  88.      than one event long, the change is actually made in another keymap
  89.      reached from KEYMAP.)  The argument BINDING can be any Lisp
  90.      object, but only certain types are meaningful.  (For a list of
  91.      meaningful types, see *Note Key Lookup::.) The value returned by
  92.      `define-key' is BINDING.
  93.  
  94.      Every prefix of KEY must be a prefix key (i.e., bound to a keymap)
  95.      or undefined; otherwise an error is signaled.
  96.  
  97.      If some prefix of KEY is undefined, then `define-key' defines it
  98.      as a prefix key so that the rest of KEY may be defined as
  99.      specified.
  100.  
  101.    Here is an example that creates a sparse keymap and makes a number of
  102. bindings in it:
  103.  
  104.      (setq map (make-sparse-keymap))
  105.          => (keymap)
  106.  
  107.      (define-key map "\C-f" 'forward-char)
  108.          => forward-char
  109.  
  110.      map
  111.          => (keymap (6 . forward-char))
  112.  
  113.      ;; Build sparse submap for `C-x' and bind `f' in that.
  114.      (define-key map "\C-xf" 'forward-word)
  115.          => forward-word
  116.  
  117.      map
  118.      => (keymap
  119.          (24 keymap                ; `C-x'
  120.              (102 . forward-word)) ;      `f'
  121.          (6 . forward-char))       ; `C-f'
  122.  
  123.      ;; Bind `C-p' to the `ctl-x-map'.
  124.      (define-key map "\C-p" ctl-x-map)
  125.      ;; `ctl-x-map'
  126.      => [nil ... find-file ... backward-kill-sentence]
  127.  
  128.      ;; Bind `C-f' to `foo' in the `ctl-x-map'.
  129.      (define-key map "\C-p\C-f" 'foo)
  130.      => 'foo
  131.  
  132.      map
  133.      => (keymap     ; Note `foo' in `ctl-x-map'.
  134.          (16 keymap [nil ... foo ... backward-kill-sentence])
  135.          (24 keymap
  136.              (102 . forward-word))
  137.          (6 . forward-char))
  138.  
  139. Note that storing a new binding for `C-p C-f' actually works by
  140. changing an entry in `ctl-x-map', and this has the effect of changing
  141. the bindings of both `C-p C-f' and `C-x C-f' in the default global map.
  142.  
  143.  - Function: substitute-key-definition OLDDEF NEWDEF KEYMAP &optional
  144.           OLDMAP
  145.      This function replaces OLDDEF with NEWDEF for any keys in KEYMAP
  146.      that were bound to OLDDEF.  In other words, OLDDEF is replaced
  147.      with NEWDEF wherever it appears.  The function returns `nil'.
  148.  
  149.      For example, this redefines `C-x C-f', if you do it in an XEmacs
  150.      with standard bindings:
  151.  
  152.           (substitute-key-definition
  153.            'find-file 'find-file-read-only (current-global-map))
  154.  
  155.      If OLDMAP is non-`nil', then its bindings determine which keys to
  156.      rebind.  The rebindings still happen in NEWMAP, not in OLDMAP.
  157.      Thus, you can change one map under the control of the bindings in
  158.      another.  For example,
  159.  
  160.           (substitute-key-definition
  161.             'delete-backward-char 'my-funny-delete
  162.             my-map global-map)
  163.  
  164.      puts the special deletion command in `my-map' for whichever keys
  165.      are globally bound to the standard deletion command.
  166.  
  167.      Here is an example showing a keymap before and after substitution:
  168.  
  169.           (setq map '(keymap
  170.                       (?1 . olddef-1)
  171.                       (?2 . olddef-2)
  172.                       (?3 . olddef-1)))
  173.           => (keymap (49 . olddef-1) (50 . olddef-2) (51 . olddef-1))
  174.  
  175.           (substitute-key-definition 'olddef-1 'newdef map)
  176.           => nil
  177.  
  178.           map
  179.           => (keymap (49 . newdef) (50 . olddef-2) (51 . newdef))
  180.  
  181.  - Function: suppress-keymap KEYMAP &optional NODIGITS
  182.      This function changes the contents of the full keymap KEYMAP by
  183.      making all the printing characters undefined.  More precisely, it
  184.      binds them to the command `undefined'.  This makes ordinary
  185.      insertion of text impossible.  `suppress-keymap' returns `nil'.
  186.  
  187.      If NODIGITS is `nil', then `suppress-keymap' defines digits to run
  188.      `digit-argument', and `-' to run `negative-argument'.  Otherwise
  189.      it makes them undefined like the rest of the printing characters.
  190.  
  191.      The `suppress-keymap' function does not make it impossible to
  192.      modify a buffer, as it does not suppress commands such as `yank'
  193.      and `quoted-insert'.  To prevent any modification of a buffer, make
  194.      it read-only (*note Read Only Buffers::.).
  195.  
  196.      Since this function modifies KEYMAP, you would normally use it on
  197.      a newly created keymap.  Operating on an existing keymap that is
  198.      used for some other purpose is likely to cause trouble; for
  199.      example, suppressing `global-map' would make it impossible to use
  200.      most of XEmacs.
  201.  
  202.      Most often, `suppress-keymap' is used to initialize local keymaps
  203.      of modes such as Rmail and Dired where insertion of text is not
  204.      desirable and the buffer is read-only.  Here is an example taken
  205.      from the file `emacs/lisp/dired.el', showing how the local keymap
  206.      for Dired mode is set up:
  207.  
  208.           ...
  209.             (setq dired-mode-map (make-keymap))
  210.             (suppress-keymap dired-mode-map)
  211.             (define-key dired-mode-map "r" 'dired-rename-file)
  212.             (define-key dired-mode-map "\C-d" 'dired-flag-file-deleted)
  213.             (define-key dired-mode-map "d" 'dired-flag-file-deleted)
  214.             (define-key dired-mode-map "v" 'dired-view-file)
  215.             (define-key dired-mode-map "e" 'dired-find-file)
  216.             (define-key dired-mode-map "f" 'dired-find-file)
  217.             ...
  218.  
  219. 
  220. File: lispref.info,  Node: Key Binding Commands,  Next: Scanning Keymaps,  Prev: Changing Key Bindings,  Up: Keymaps
  221.  
  222. Commands for Binding Keys
  223. =========================
  224.  
  225.    This section describes some convenient interactive interfaces for
  226. changing key bindings.  They work by calling `define-key'.
  227.  
  228.    People often use `global-set-key' in their `.emacs' file for simple
  229. customization.  For example,
  230.  
  231.      (global-set-key "\C-x\C-\\" 'next-line)
  232.  
  233. or
  234.  
  235.      (global-set-key [?\C-x ?\C-\\] 'next-line)
  236.  
  237. or
  238.  
  239.      (global-set-key [(control ?x) (control ?\\)] 'next-line)
  240.  
  241. redefines `C-x C-\' to move down a line.
  242.  
  243.      (global-set-key [M-mouse-1] 'mouse-set-point)
  244.  
  245. redefines the first (leftmost) mouse button, typed with the Meta key, to
  246. set point where you click.
  247.  
  248.  - Command: global-set-key KEY DEFINITION
  249.      This function sets the binding of KEY in the current global map to
  250.      DEFINITION.
  251.  
  252.           (global-set-key KEY DEFINITION)
  253.           ==
  254.           (define-key (current-global-map) KEY DEFINITION)
  255.  
  256.  - Command: global-unset-key KEY
  257.      This function removes the binding of KEY from the current global
  258.      map.
  259.  
  260.      One use of this function is in preparation for defining a longer
  261.      key that uses KEY as a prefix--which would not be allowed if KEY
  262.      has a non-prefix binding.  For example:
  263.  
  264.           (global-unset-key "\C-l")
  265.               => nil
  266.  
  267.           (global-set-key "\C-l\C-l" 'redraw-display)
  268.               => nil
  269.  
  270.      This function is implemented simply using `define-key':
  271.  
  272.           (global-unset-key KEY)
  273.           ==
  274.           (define-key (current-global-map) KEY nil)
  275.  
  276.  - Command: local-set-key KEY DEFINITION
  277.      This function sets the binding of KEY in the current local keymap
  278.      to DEFINITION.
  279.  
  280.           (local-set-key KEY DEFINITION)
  281.           ==
  282.           (define-key (current-local-map) KEY DEFINITION)
  283.  
  284.  - Command: local-unset-key KEY
  285.      This function removes the binding of KEY from the current local
  286.      map.
  287.  
  288.           (local-unset-key KEY)
  289.           ==
  290.           (define-key (current-local-map) KEY nil)
  291.  
  292. 
  293. File: lispref.info,  Node: Scanning Keymaps,  Prev: Key Binding Commands,  Up: Keymaps
  294.  
  295. Scanning Keymaps
  296. ================
  297.  
  298.    This section describes functions used to scan all the current keymaps
  299. for the sake of printing help information.
  300.  
  301.  - Function: accessible-keymaps KEYMAP &optional PREFIX
  302.      This function returns a list of all the keymaps that can be
  303.      accessed (via prefix keys) from KEYMAP.  The value is an
  304.      association list with elements of the form `(KEY . MAP)', where
  305.      KEY is a prefix key whose definition in KEYMAP is MAP.
  306.  
  307.      The elements of the alist are ordered so that the KEY increases in
  308.      length.  The first element is always `("" . KEYMAP)', because the
  309.      specified keymap is accessible from itself with a prefix of no
  310.      events.
  311.  
  312.      If PREFIX is given, it should be a prefix key sequence; then
  313.      `accessible-keymaps' includes only the submaps whose prefixes start
  314.      with PREFIX.  These elements look just as they do in the value of
  315.      `(accessible-keymaps)'; the only difference is that some elements
  316.      are omitted.
  317.  
  318.      In the example below, the returned alist indicates that the key
  319.      ESC, which is displayed as `^[', is a prefix key whose definition
  320.      is the sparse keymap `(keymap (83 . center-paragraph) (115 .
  321.      foo))'.
  322.  
  323.           (accessible-keymaps (current-local-map))
  324.           =>(("" keymap
  325.                 (27 keymap   ; Note this keymap for ESC is repeated below.
  326.                     (83 . center-paragraph)
  327.                     (115 . center-line))
  328.                 (9 . tab-to-tab-stop))
  329.  
  330.           ("^[" keymap
  331.               (83 . center-paragraph)
  332.               (115 . foo)))
  333.  
  334.      These are not all the keymaps you would see in an actual case.
  335.  
  336.  - Function: where-is-internal COMMAND &optional KEYMAP FIRSTONLY
  337.           NOINDIRECT
  338.      This function returns a list of key sequences (of any length) that
  339.      are bound to COMMAND in a set of keymaps.
  340.  
  341.      The argument COMMAND can be any object; it is compared with all
  342.      keymap entries using `eq'.
  343.  
  344.      If KEYMAP is `nil', then the maps used are the current active
  345.      keymaps, disregarding `overriding-local-map' (that is, pretending
  346.      its value is `nil').  If KEYMAP is non-`nil', then the maps
  347.      searched are KEYMAP and the global keymap.
  348.  
  349.      Usually it's best to use `overriding-local-map' as the expression
  350.      for KEYMAP.  Then `where-is-internal' searches precisely the
  351.      keymaps that are active.  To search only the global map, pass
  352.      `(keymap)' (an empty keymap) as KEYMAP.
  353.  
  354.      If FIRSTONLY is `non-ascii', then the value is a single string
  355.      representing the first key sequence found, rather than a list of
  356.      all possible key sequences.  If FIRSTONLY is `t', then the value
  357.      is the first key sequence, except that key sequences consisting
  358.      entirely of ASCII characters (or meta variants of ASCII
  359.      characters) are preferred to all other key sequences.
  360.  
  361.      If NOINDIRECT is non-`nil', `where-is-internal' doesn't follow
  362.      indirect keymap bindings.  This makes it possible to search for an
  363.      indirect definition itself.
  364.  
  365.      This function is used by `where-is' (*note Help: (emacs)Help.).
  366.  
  367.           (where-is-internal 'describe-function)
  368.               => ("\^hf" "\^hd")
  369.  
  370.  - Command: describe-bindings PREFIX
  371.      This function creates a listing of all defined keys and their
  372.      definitions.  It writes the listing in a buffer named `*Help*' and
  373.      displays it in a window.
  374.  
  375.      If PREFIX is non-`nil', it should be a prefix key; then the
  376.      listing includes only keys that start with PREFIX.
  377.  
  378.      The listing describes meta characters as ESC followed by the
  379.      corresponding non-meta character.
  380.  
  381.      When several characters with consecutive ASCII codes have the same
  382.      definition, they are shown together, as `FIRSTCHAR..LASTCHAR'.  In
  383.      this instance, you need to know the ASCII codes to understand
  384.      which characters this means.  For example, in the default global
  385.      map, the characters `SPC .. ~' are described by a single line.
  386.      SPC is ASCII 32, `~' is ASCII 126, and the characters between them
  387.      include all the normal printing characters, (e.g., letters,
  388.      digits, punctuation, etc.); all these characters are bound to
  389.      `self-insert-command'.
  390.  
  391. 
  392. File: lispref.info,  Node: Menus,  Next: Dialog Boxes,  Prev: Keymaps,  Up: Top
  393.  
  394. Menus
  395. *****
  396.  
  397. * Menu:
  398.  
  399. * Menu Format::        Format of a menu description.
  400. * Menubar Format::    How to specify a menubar.
  401. * Menubar::        Functions for controlling the menubar.
  402. * Modifying Menus::    Modifying a menu description.
  403. * Pop-Up Menus::    Functions for specifying pop-up menus.
  404. * Menu Filters::    Filter functions for the default menubar.
  405. * Buffers Menu::    The menu that displays the list of buffers.
  406.  
  407. 
  408. File: lispref.info,  Node: Menu Format,  Next: Menubar Format,  Up: Menus
  409.  
  410. Format of Menus
  411. ===============
  412.  
  413.    A menu is described using a "menu description", which is a list of
  414. menu items, keyword-value pairs, strings, and submenus.  The menu
  415. description specifies which items are present in the menu, what function
  416. each item invokes, and whether the item is selectable or not.  Pop-up
  417. menus are directly described with a menu description, while menubars are
  418. described slightly differently (see below).
  419.  
  420.    The first element of a menu must be a string, which is the name of
  421. the menu.  This is the string that will be displayed in the parent menu
  422. or menubar, if any.  This string is not displayed in the menu itself,
  423. except in the case of the top level pop-up menu, where there is no
  424. parent.  In this case, the string will be displayed at the top of the
  425. menu if `popup-menu-titles' is non-`nil'.
  426.  
  427.    Immediately following the first element there may optionally be up
  428. to three keyword-value pairs, as follows:
  429.  
  430. `:included FORM'
  431.      This can be used to control the visibility of a menu.  The form is
  432.      evaluated and the menu will be omitted if the result is `nil'.
  433.  
  434. `:config SYMBOL'
  435.      This is an efficient shorthand for `:included (memq SYMBOL
  436.      menubar-configuration)'.  See the variable `menubar-configuration'.
  437.  
  438. `:filter FUNCTION'
  439.      A menu filter is used to sensitize or incrementally create a
  440.      submenu only when it is selected by the user and not every time
  441.      the menubar is activated.  The filter function is passed the list
  442.      of menu items in the submenu and must return a list of menu items
  443.      to be used for the menu.  It is called only when the menu is about
  444.      to be displayed, so other menus may already be displayed.  Vile
  445.      and terrible things will happen if a menu filter function changes
  446.      the current buffer, window, or frame.  It also should not raise,
  447.      lower, or iconify any frames.  Basically, the filter function
  448.      should have no side-effects.
  449.  
  450.    The rest of the menu consists of elements as follows:
  451.  
  452.    * A "menu item", which is a vector in the following form:
  453.  
  454.           `[ NAME CALLBACK :KEYWORD VALUE :KEYWORD VALUE ... ]'
  455.  
  456.      NAME is a string, the name of the menu item; it is the string to
  457.      display on the menu.  It is filtered through the resource
  458.      database, so it is possible for resources to override what string
  459.      is actually displayed.
  460.  
  461.      CALLBACK is a form that will be invoked when the menu item is
  462.      selected.  If the callback of a menu item is a symbol, then it
  463.      must name a command.  It will be invoked with
  464.      `call-interactively'.  If it is a list, then it is evaluated with
  465.      `eval'.
  466.  
  467.      The valid keywords and their meanings are described below.
  468.  
  469.      Note that for compatibility purposes, the form
  470.  
  471.           `[ NAME CALLBACK ACTIVE-P ]'
  472.  
  473.      is also accepted and is equivalent to
  474.  
  475.           `[ NAME CALLBACK :active ACTIVE-P ]'
  476.  
  477.      and the form
  478.  
  479.           `[ NAME CALLBACK ACTIVE-P SUFFIX]'
  480.  
  481.      is accepted and is equivalent to
  482.  
  483.           `[ NAME CALLBACK :active ACTIVE-P :suffix SUFFIX]'
  484.  
  485.      However, these older forms are deprecated and should generally not
  486.      be used.
  487.  
  488.    * If an element of a menu is a string, then that string will be
  489.      presented in the menu as unselectable text.
  490.  
  491.    * If an element of a menu is a string consisting solely of hyphens,
  492.      then that item will be presented as a solid horizontal line.
  493.  
  494.    * If an element of a menu is a string beginning with `--:', then a
  495.      particular sort of horizontal line will be displayed, as follows:
  496.  
  497.     `"--:singleLine"'
  498.           A solid horizontal line.  This is equivalent to a string
  499.           consisting solely of hyphens.
  500.  
  501.     `"--:doubleLine"'
  502.           A solid double horizontal line.
  503.  
  504.     `"--:singleDashedLine"'
  505.           A dashed horizontal line.
  506.  
  507.     `"--:doubleDashedLine"'
  508.           A dashed double horizontal line.
  509.  
  510.     `"--:noLine"'
  511.           No line (but a small space is left).
  512.  
  513.     `"--:shadowEtchedIn"'
  514.           A solid horizontal line with a 3-d recessed appearance.
  515.  
  516.     `"--:shadowEtchedOut"'
  517.           A solid horizontal line with a 3-d pushed-out appearance.
  518.  
  519.     `"--:shadowDoubleEtchedIn"'
  520.           A solid double horizontal line with a 3-d recessed appearance.
  521.  
  522.     `"--:shadowDoubleEtchedOut"'
  523.           A solid double horizontal line with a 3-d pushed-out
  524.           appearance.
  525.  
  526.     `"--:shadowEtchedInDash"'
  527.           A dashed horizontal line with a 3-d recessed appearance.
  528.  
  529.     `"--:shadowEtchedOutDash"'
  530.           A dashed horizontal line with a 3-d pushed-out appearance.
  531.  
  532.     `"--:shadowDoubleEtchedInDash"'
  533.           A dashed double horizontal line with a 3-d recessed
  534.           appearance.
  535.  
  536.     `"--:shadowDoubleEtchedOutDash"'
  537.           A dashed double horizontal line with a 3-d pushed-out
  538.           appearance.
  539.  
  540.    * If an element of a menu is a list, it is treated as a submenu.
  541.      The name of that submenu (the first element in the list) will be
  542.      used as the name of the item representing this menu on the parent.
  543.  
  544.    The possible keywords are as follows:
  545.  
  546. :active FORM
  547.      FORM will be evaluated when the menu that this item is a part of
  548.      is about to be displayed, and the item will be selectable only if
  549.      the result is non-`nil'.  If the item is unselectable, it will
  550.      usually be displayed grayed-out to indicate this.
  551.  
  552. :suffix STRING
  553.      The string is appended to the displayed name.  This provides a
  554.      convenient way of adding the name of a command's "argument" to the
  555.      menu, like  like `Kill Buffer NAME'.
  556.  
  557. :keys STRING
  558.      Normally, the keyboard equivalents of commands in menus are
  559.      displayed when the "callback" is a symbol.  This can be used to
  560.      specify keys for more complex menu items.  It is passed through
  561.      `substitute-command-keys' first.
  562.  
  563. :style STYLE
  564.      Specifies what kind of object this menu item is.  STYLE be one of
  565.      the symbols
  566.  
  567.     `nil'
  568.           A normal menu item.
  569.  
  570.     `toggle'
  571.           A toggle button.
  572.  
  573.     `radio'
  574.           A radio button.
  575.  
  576.     `button'
  577.           A menubar button.
  578.  
  579.      The only difference between toggle and radio buttons is how they
  580.      are displayed.  But for consistency, a toggle button should be
  581.      used when there is one option whose value can be turned on or off,
  582.      and radio buttons should be used when there is a set of mutally
  583.      exclusive options.  When using a group of radio buttons, you
  584.      should arrange for no more than one to be marked as selected at a
  585.      time.
  586.  
  587. :selected FORM
  588.      Meaningful only when STYLE is `toggle', `radio' or `button'.  This
  589.      specifies whether the button will be in the selected or unselected
  590.      state.  FORM is evaluated, as for `:active'.
  591.  
  592. :included FORM
  593.      This can be used to control the visibility of a menu item.  The
  594.      form is evaluated and the menu item is only displayed if the
  595.      result is non-`nil'.  Note that this is different from `:active':
  596.      If `:active' evaluates to `nil', the item will be displayed grayed
  597.      out, while if `:included' evaluates to `nil', the item will be
  598.      omitted entirely.
  599.  
  600. :config SYMBOL
  601.      This is an efficient shorthand for `:included (memq SYMBOL
  602.      menubar-configuration)'.  See the variable `menubar-configuration'.
  603.  
  604.  - Variable: menubar-configuration
  605.      This variable holds a list of symbols, against which the value of
  606.      the `:config' tag for each menubar item will be compared.  If a
  607.      menubar item has a `:config' tag, then it is omitted from the
  608.      menubar if that tag is not a member of the `menubar-configuration'
  609.      list.
  610.  
  611.    For example:
  612.  
  613.       ("File"
  614.        :filter file-menu-filter    ; file-menu-filter is a function that takes
  615.                      ; one argument (a list of menu items) and
  616.                      ; returns a list of menu items
  617.        [ "Save As..."    write-file  t ]
  618.        [ "Revert Buffer" revert-buffer (buffer-modified-p) ]
  619.        [ "Read Only"     toggle-read-only :style toggle :selected buffer-read-only ]
  620.        )
  621.  
  622. 
  623. File: lispref.info,  Node: Menubar Format,  Next: Menubar,  Prev: Menu Format,  Up: Menus
  624.  
  625. Format of the Menubar
  626. =====================
  627.  
  628.    A menubar is a list of menus, menu items, and strings.  The format is
  629. similar to that of a menu, except:
  630.  
  631.    * The first item need not be a string, and is not treated specially.
  632.  
  633.    * A string consisting solely of hyphens is not treated specially.
  634.  
  635.    * If an element of a menubar is `nil', then it is used to represent
  636.      the division between the set of menubar items which are flush-left
  637.      and those which are flush-right.  (Note: this isn't completely
  638.      implemented yet.)
  639.  
  640. 
  641. File: lispref.info,  Node: Menubar,  Next: Modifying Menus,  Prev: Menubar Format,  Up: Menus
  642.  
  643. Menubar
  644. =======
  645.  
  646.  - Variable: current-menubar
  647.      This variable holds the description of the current menubar.  This
  648.      may be buffer-local.  When the menubar is changed, the function
  649.      `set-menubar-dirty-flag' has to be called in order for the menubar
  650.      to be updated on the screen.
  651.  
  652.  - Constant: default-menubar
  653.      This variable holds the menubar description of the menubar that is
  654.      visible at startup.  This is the value that `current-menubar' has
  655.      at startup.
  656.  
  657.  - Function: set-menubar-dirty-flag
  658.      This function tells XEmacs that the menubar widget has to be
  659.      updated.  Changes to the menubar will generally not be visible
  660.      until this function is called.
  661.  
  662.    The following convenience functions are provided for setting the
  663. menubar.  They are equivalent to doing the appropriate action to change
  664. `current-menubar', and then calling `set-menubar-dirty-flag'.  Note
  665. that these functions copy their argument using `copy-sequence'.
  666.  
  667.  - Function: set-menubar MENUBAR
  668.      This function sets the default menubar to be MENUBAR (*note Menu
  669.      Format::.).  This is the menubar that will be visible in buffers
  670.      that have not defined their own, buffer-local menubar.
  671.  
  672.  - Function: set-buffer-menubar MENUBAR
  673.      This function sets the buffer-local menubar to be MENUBAR.  This
  674.      does not change the menubar in any buffers other than the current
  675.      one.
  676.  
  677.    Miscellaneous:
  678.  
  679.  - Variable: menubar-show-keybindings
  680.      If true, the menubar will display keyboard equivalents.  If false,
  681.      only the command names will be displayed.
  682.  
  683.  - Variable: activate-menubar-hook
  684.      Function or functions called before a menubar menu is pulled down.
  685.      These functions are called with no arguments, and should
  686.      interrogate and modify the value of `current-menubar' as desired.
  687.  
  688.      The functions on this hook are invoked after the mouse goes down,
  689.      but before the menu is mapped, and may be used to activate,
  690.      deactivate, add, or delete items from the menus.  However, using a
  691.      filter (with the `:filter' keyword in a menu description) is
  692.      generally a more efficient way of accomplishing the same thing,
  693.      because the filter is invoked only when the actual menu goes down.
  694.      With a complex menu, there can be a quite noticeable and
  695.      sometimes aggravating delay if all menu modification is
  696.      implemented using the `activate-menubar-hook'.  See above.
  697.  
  698.      These functions may return the symbol `t' to assert that they have
  699.      made no changes to the menubar.  If any other value is returned,
  700.      the menubar is recomputed.  If `t' is returned but the menubar has
  701.      been changed, then the changes may not show up right away.
  702.      Returning `nil' when the menubar has not changed is not so bad;
  703.      more computation will be done, but redisplay of the menubar will
  704.      still be performed optimally.
  705.  
  706.  - Variable: menu-no-selection-hook
  707.      Function or functions to call when a menu or dialog box is
  708.      dismissed without a selection having been made.
  709.  
  710. 
  711. File: lispref.info,  Node: Modifying Menus,  Next: Pop-Up Menus,  Prev: Menubar,  Up: Menus
  712.  
  713. Modifying Menus
  714. ===============
  715.  
  716.    The following functions are provided to modify the menubar of one of
  717. its submenus.  Note that these functions modify the menu in-place,
  718. rather than copying it and making a new menu.
  719.  
  720.    Some of these functions take a "menu path", which is a list of
  721. strings identifying the menu to be modified.  For example, `("File")'
  722. names the top-level "File" menu.  `("File" "Foo")' names a hypothetical
  723. submenu of "File".
  724.  
  725.    Others take a "menu item path", which is similar to a menu path but
  726. also specifies a particular item to be modified.  For example, `("File"
  727. "Save")' means the menu item called "Save" under the top-level "File"
  728. menu.  `("Menu" "Foo" "Item")' means the menu item called "Item" under
  729. the "Foo" submenu of "Menu".
  730.  
  731.  - Function: add-submenu MENU-PATH SUBMENU &optional BEFORE
  732.      This function adds a menu to the menubar or one of its submenus.
  733.      If the named menu exists already, it is changed.
  734.  
  735.      MENU-PATH identifies the menu under which the new menu should be
  736.      inserted.  If MENU-PATH is `nil', then the menu will be added to
  737.      the menubar itself.
  738.  
  739.      SUBMENU is the new menu to add (*note Menu Format::.).
  740.  
  741.      BEFORE, if provided, is the name of a menu before which this menu
  742.      should be added, if this menu is not on its parent already.  If
  743.      the menu is already present, it will not be moved.
  744.  
  745.  - Function: add-menu-button MENU-PATH MENU-LEAF &optional BEFORE
  746.      This function adds a menu item to some menu, creating the menu
  747.      first if necessary.  If the named item exists already, it is
  748.      changed.
  749.  
  750.      MENU-PATH identifies the menu under which the new menu item should
  751.      be inserted.
  752.  
  753.      MENU-LEAF is a menubar leaf node (*note Menu Format::.).
  754.  
  755.      BEFORE, if provided, is the name of a menu before which this item
  756.      should be added, if this item is not on the menu already.  If the
  757.      item is already present, it will not be moved.
  758.  
  759.  - Function: delete-menu-item MENU-ITEM-PATH
  760.      This function removes the menu item specified by MENU-ITEM-PATH
  761.      from the menu hierarchy.
  762.  
  763.  - Function: enable-menu-item MENU-ITEM-PATH
  764.      This function makes the menu item specified by MENU-ITEM-PATH be
  765.      selectable.
  766.  
  767.  - Function: disable-menu-item MENU-ITEM-PATH
  768.      This function makes the menu item specified by MENU-ITEM-PATH be
  769.      unselectable.
  770.  
  771.  - Function: relabel-menu-item MENU-ITEM-PATH NEW-NAME
  772.      This function changes the string of the menu item specified by
  773.      MENU-ITEM-PATH.  NEW-NAME is the string that the menu item will be
  774.      printed as from now on.
  775.  
  776.    The following function can be used to search for a particular item in
  777. a menubar specification, given a path to the item.
  778.  
  779.  - Function: find-menu-item MENUBAR MENU-ITEM-PATH &optional PARENT
  780.      This function searches MENUBAR for the item given by
  781.      MENU-ITEM-PATH starting from PARENT (`nil' means start at the top
  782.      of MENUBAR).  This function returns `(ITEM . PARENT)', where
  783.      PARENT is the immediate parent of the item found (a menu
  784.      description), and ITEM is either a vector, list, or string,
  785.      depending on the nature of the menu item.
  786.  
  787.      This function signals an error if the item is not found.
  788.  
  789.    The following deprecated functions are also documented, so that
  790. existing code can be understood.  You should not use these functions in
  791. new code.
  792.  
  793.  - Function: add-menu MENU-PATH MENU-NAME MENU-ITEMS &optional BEFORE
  794.      This function adds a menu to the menubar or one of its submenus.
  795.      If the named menu exists already, it is changed.  This is
  796.      obsolete; use `add-submenu' instead.
  797.  
  798.      MENU-PATH identifies the menu under which the new menu should be
  799.      inserted.  If MENU-PATH is `nil', then the menu will be added to
  800.      the menubar itself.
  801.  
  802.      MENU-NAME is the string naming the menu to be added; MENU-ITEMS is
  803.      a list of menu items, strings, and submenus.  These two arguments
  804.      are the same as the first and following elements of a menu
  805.      description (*note Menu Format::.).
  806.  
  807.      BEFORE, if provided, is the name of a menu before which this menu
  808.      should be added, if this menu is not on its parent already.  If the
  809.      menu is already present, it will not be moved.
  810.  
  811.  - Function: add-menu-item MENU-PATH ITEM-NAME FUNCTION ENABLED-P
  812.           &optional BEFORE
  813.      This function adds a menu item to some menu, creating the menu
  814.      first if necessary.  If the named item exists already, it is
  815.      changed.  This is obsolete; use `add-menu-button' instead.
  816.  
  817.      MENU-PATH identifies the menu under which the new menu item should
  818.      be inserted. ITEM-NAME, FUNCTION, and ENABLED-P are the first,
  819.      second, and third elements of a menu item vector (*note Menu
  820.      Format::.).
  821.  
  822.      BEFORE, if provided, is the name of a menu item before which this
  823.      item should be added, if this item is not on the menu already.  If
  824.      the item is already present, it will not be moved.
  825.  
  826. 
  827. File: lispref.info,  Node: Menu Filters,  Next: Buffers Menu,  Prev: Pop-Up Menus,  Up: Menus
  828.  
  829. Menu Filters
  830. ============
  831.  
  832.    The following filter functions are provided for use in
  833. `default-menubar'.  You may want to use them in your own menubar
  834. description.
  835.  
  836.  - Function: file-menu-filter MENU-ITEMS
  837.      This function changes the arguments and sensitivity of these File
  838.      menu items:
  839.  
  840.     `Delete Buffer'
  841.           Has the name of the current buffer appended to it.
  842.  
  843.     `Print Buffer'
  844.           Has the name of the current buffer appended to it.
  845.  
  846.     `Pretty-Print Buffer'
  847.           Has the name of the current buffer appended to it.
  848.  
  849.     `Save Buffer'
  850.           Has the name of the current buffer appended to it, and is
  851.           sensitive only when the current buffer is modified.
  852.  
  853.     `Revert Buffer'
  854.           Has the name of the current buffer appended to it, and is
  855.           sensitive only when the current buffer has a file.
  856.  
  857.     `Delete Frame'
  858.           Sensitive only when there is more than one visible frame.
  859.  
  860.  - Function: edit-menu-filter MENU-ITEMS
  861.      This function changes the arguments and sensitivity of these Edit
  862.      menu items:
  863.  
  864.     `Cut'
  865.           Sensitive only when XEmacs owns the primary X Selection (if
  866.           `zmacs-regions' is `t', this is equivalent to saying that
  867.           there is a region selected).
  868.  
  869.     `Copy'
  870.           Sensitive only when XEmacs owns the primary X Selection.
  871.  
  872.     `Clear'
  873.           Sensitive only when XEmacs owns the primary X Selection.
  874.  
  875.     `Paste'
  876.           Sensitive only when there is an owner for the X Clipboard
  877.           Selection.
  878.  
  879.     `Undo'
  880.           Sensitive only when there is undo information.  While in the
  881.           midst of an undo, this is changed to `Undo More'.
  882.  
  883.  - Function: buffers-menu-filter MENU-ITEMS
  884.      This function sets up the Buffers menu.  *Note Buffers Menu:: for
  885.      more information.
  886.  
  887. 
  888. File: lispref.info,  Node: Pop-Up Menus,  Next: Menu Filters,  Prev: Modifying Menus,  Up: Menus
  889.  
  890. Pop-Up Menus
  891. ============
  892.  
  893.  - Function: popup-menu MENU-DESC
  894.      This function pops up a menu specified by MENU-DESC, which is a
  895.      menu description (*note Menu Format::.).  The menu is displayed at
  896.      the current mouse position.
  897.  
  898.  - Function: popup-menu-up-p
  899.      This function returns `t' if a pop-up menu is up, `nil' otherwise.
  900.  
  901.  - Variable: popup-menu-titles
  902.      If true (the default), pop-up menus will have title bars at the
  903.      top.
  904.  
  905.    Some machinery is provided that attempts to provide a higher-level
  906. mechanism onto pop-up menus.  This only works if you do not redefine
  907. the binding for button3.
  908.  
  909.  - Command: popup-mode-menu
  910.      This function pops up a menu of global and mode-specific commands.
  911.      The menu is computed by combining `global-popup-menu' and
  912.      `mode-popup-menu'.  This is the default binding for button3.  You
  913.      should generally not change this binding.
  914.  
  915.  - Variable: global-popup-menu
  916.      This holds the global popup menu.  This is present in all modes.
  917.      (This is `nil' by default.)
  918.  
  919.  - Variable: mode-popup-menu
  920.      The mode-specific popup menu.  Automatically buffer local.  This
  921.      is appended to the default items in `global-popup-menu'.
  922.  
  923.  - Constant: default-popup-menu
  924.      This holds the default value of `mode-popup-menu'.
  925.  
  926.  - Variable: activate-popup-menu-hook
  927.      Function or functions run before a mode-specific popup menu is made
  928.      visible.  These functions are called with no arguments, and should
  929.      interrogate and modify the value of `global-popup-menu' or
  930.      `mode-popup-menu' as desired.  Note: this hook is only run if you
  931.      use `popup-mode-menu' for activating the global and mode-specific
  932.      commands; if you have your own binding for button3, this hook
  933.      won't be run.
  934.  
  935.    The following convenience functions are provided for displaying
  936. pop-up menus.
  937.  
  938.  - Function: popup-buffer-menu EVENT
  939.      This function pops up a copy of the `Buffers' menu (from the
  940.      menubar) where the mouse is clicked.
  941.  
  942.  - Function: popup-menubar-menu EVENT
  943.      This function pops up a copy of menu that also appears in the
  944.      menubar.
  945.  
  946. 
  947. File: lispref.info,  Node: Buffers Menu,  Prev: Menu Filters,  Up: Menus
  948.  
  949. Buffers Menu
  950. ============
  951.  
  952.    The following options control how the `Buffers' menu is displayed.
  953. This is a list of all (or a subset of) the buffers currently in
  954. existence, and is updated dynamically.
  955.  
  956.  - User Option: buffers-menu-max-size
  957.      This user option holds the maximum number of entries which may
  958.      appear on the `Buffers' menu.  If this is 10, then only the ten
  959.      most-recently-selected buffers will be shown.  If this is `nil',
  960.      then all buffers will be shown.  Setting this to a large number or
  961.      `nil' will slow down menu responsiveness.
  962.  
  963.  - Function: format-buffers-menu-line BUFFER
  964.      This function returns a string to represent BUFFER in the
  965.      `Buffers' menu.  `nil' means the buffer shouldn't be listed.  You
  966.      can redefine this.
  967.  
  968.  - User Option: complex-buffers-menu-p
  969.      If true, the `Buffers' menu will contain several commands, as
  970.      submenus of each buffer line.  If this is false, then there will
  971.      be only one command: select that buffer.
  972.  
  973.  - User Option: buffers-menu-switch-to-buffer-function
  974.      This user option holds the function to call to select a buffer
  975.      from the `Buffers' menu.  `switch-to-buffer' is a good choice, as
  976.      is `pop-to-buffer'.
  977.  
  978. 
  979. File: lispref.info,  Node: Dialog Boxes,  Next: Toolbar,  Prev: Menus,  Up: Top
  980.  
  981. Dialog Boxes
  982. ************
  983.  
  984. * Menu:
  985.  
  986. * Dialog Box Format::
  987. * Dialog Box Functions::
  988.  
  989. 
  990. File: lispref.info,  Node: Dialog Box Format,  Next: Dialog Box Functions,  Up: Dialog Boxes
  991.  
  992. Dialog Box Format
  993. =================
  994.  
  995.    A dialog box description is a list.
  996.  
  997.    * The first element of the list is a string to display in the dialog
  998.      box.
  999.  
  1000.    * The rest of the elements are descriptions of the dialog box's
  1001.      buttons.  Each one is a vector of three elements:
  1002.         - The first element is the text of the button.
  1003.  
  1004.         - The second element is the "callback".
  1005.  
  1006.         - The third element is `t' or `nil', whether this button is
  1007.           selectable.
  1008.  
  1009.    If the callback of a button is a symbol, then it must name a command.
  1010. It will be invoked with `call-interactively'.  If it is a list, then it
  1011. is evaluated with `eval'.
  1012.  
  1013.    One (and only one) of the buttons may be `nil'.  This marker means
  1014. that all following buttons should be flushright instead of flushleft.
  1015.  
  1016.    The syntax, more precisely:
  1017.  
  1018.         form        :=  <something to pass to `eval'>
  1019.         command    :=  <a symbol or string, to pass to `call-interactively'>
  1020.         callback     :=  command | form
  1021.         active-p    :=  <t, nil, or a form to evaluate to decide whether this
  1022.                  button should be selectable>
  1023.         name        :=  <string>
  1024.         partition    :=  'nil'
  1025.         button    :=  '['  name callback active-p ']'
  1026.         dialog    :=  '(' name [ button ]+ [ partition [ button ]+ ] ')'
  1027.  
  1028. 
  1029. File: lispref.info,  Node: Dialog Box Functions,  Prev: Dialog Box Format,  Up: Dialog Boxes
  1030.  
  1031. Dialog Box Functions
  1032. ====================
  1033.  
  1034.  - Function: popup-dialog-box DBOX-DESC
  1035.      This function pops up a dialog box.  DBOX-DESC describes how the
  1036.      dialog box will appear (*note Dialog Box Format::.).
  1037.  
  1038.    *Note Yes-or-No Queries::, for functions to ask a yes/no question
  1039. using a dialog box.
  1040.  
  1041. 
  1042. File: lispref.info,  Node: Toolbar,  Next: Scrollbars,  Prev: Dialog Boxes,  Up: Top
  1043.  
  1044. Toolbar
  1045. *******
  1046.  
  1047. * Menu:
  1048.  
  1049. * Toolbar Intro::        An introduction.
  1050. * Toolbar Descriptor Format::    How to create a toolbar.
  1051. * Specifying the Toolbar::    Setting a toolbar.
  1052. * Other Toolbar Variables::    Controlling the size of toolbars.
  1053.  
  1054. 
  1055. File: lispref.info,  Node: Toolbar Intro,  Next: Toolbar Descriptor Format,  Up: Toolbar
  1056.  
  1057. Toolbar Intro
  1058. =============
  1059.  
  1060.    #### Not yet written.
  1061.  
  1062. 
  1063. File: lispref.info,  Node: Toolbar Descriptor Format,  Next: Specifying the Toolbar,  Prev: Toolbar Intro,  Up: Toolbar
  1064.  
  1065. Toolbar Descriptor Format
  1066. =========================
  1067.  
  1068.    The format of a toolbar descriptor is a list of toolbar button
  1069. descriptors.  Each toolbar button descriptor is a vector in one of the
  1070. following formats:
  1071.  
  1072.    * `[GLYPH-LIST FUNCTION ENABLED-P HELP]'
  1073.  
  1074.    * `[:style 2D-OR-3D]'
  1075.  
  1076.    * `[:style 2D-OR-3D :size WIDTH-OR-HEIGHT]'
  1077.  
  1078.    * `[:size WIDTH-OR-HEIGHT :style 2D-OR-3D]'
  1079.  
  1080.    Optionally, one of the toolbar-button-descriptors may be `nil'
  1081. instead of a vector; this signifies the division between the toolbar
  1082. buttons that are to be displayed flush-left, and the buttons to be
  1083. displayed flush-right.
  1084.  
  1085.    The first vector format above specifies a normal toolbar button; the
  1086. others specify blank areas in the toolbar.
  1087.  
  1088.    For the first vector format:
  1089.  
  1090.    * GLYPH-LIST should be a list of one to three glyphs (as created by
  1091.      `make-glyph') or a symbol whose value is such a list.  The first
  1092.      glyph, which must be provided, is the glyph used to display the
  1093.      toolbar button when it is in the "up" (not pressed) state.  The
  1094.      optional second glyph is for displaying the button when it is in
  1095.      the "down" (pressed) state.  The optional third glyph is for when
  1096.      the button is disabled.  The function `toolbar-make-button-list'
  1097.      is useful in creating these glyph lists.
  1098.  
  1099.    * Even if you do not provide separate down-state and disabled-state
  1100.      glyphs, the user will still get visual feedback to indicate which
  1101.      state the button is in.  Buttons in the up-state are displayed
  1102.      with a shadowed border that gives a raised appearance to the
  1103.      button.  Buttons in the down-state are displayed with shadows that
  1104.      give a recessed appearance.  Buttons in the disabled state and
  1105.      displayed with no shadows, giving a 2-d effect.
  1106.  
  1107.    * The second element FUNCTION is a function to be called when the
  1108.      toolbar button is activated (i.e. when the mouse is released over
  1109.      the toolbar button, if the press occurred in the toolbar).  It can
  1110.      be any form accepted by `call-interactively', since this is how it
  1111.      is invoked.
  1112.  
  1113.    * The third element ENABLED-P specifies whether the toolbar button
  1114.      is enabled (disabled buttons do nothing when they are activated,
  1115.      and are displayed differently; see above).  It should be either a
  1116.      boolean or a form that evaluates to a boolean.
  1117.  
  1118.    * The fourth element HELP, if non-`nil', should be a string.  This
  1119.      string is displayed in the echo area when the mouse passes over the
  1120.      toolbar button.
  1121.  
  1122.    For the other vector formats (specifying blank areas of the toolbar):
  1123.  
  1124.    * 2D-OR-3D should be one of the symbols `2d' or `3d', indicating
  1125.      whether the area is displayed with shadows (giving it a raised,
  1126.      3-d appearance) or without shadows (giving it a flat appearance).
  1127.  
  1128.    * WIDTH-OR-HEIGHT specifies the length, in pixels, of the blank
  1129.      area.  If omitted, it defaults to a device-specific value (8
  1130.      pixels for X devices).
  1131.  
  1132.  - Function: toolbar-make-button-list UP &optional DOWN DISABLED
  1133.      This function calls `make-glyph' on each arg and returns a list of
  1134.      the results.  This is useful for setting the first argument of a
  1135.      toolbar button descriptor (typically, the result of this function
  1136.      is assigned to a symbol, which is specified as the first argument
  1137.      of the toolbar button descriptor).
  1138.  
  1139.  - Function: check-toolbar-button-syntax BUTTON &optional NOERROR
  1140.      Verify the syntax of entry BUTTON in a toolbar description list.
  1141.      If you want to verify the syntax of a toolbar description list as a
  1142.      whole, use `check-valid-instantiator' with a specifier type of
  1143.      `toolbar'.
  1144.  
  1145. 
  1146. File: lispref.info,  Node: Specifying the Toolbar,  Next: Other Toolbar Variables,  Prev: Toolbar Descriptor Format,  Up: Toolbar
  1147.  
  1148. Specifying the Toolbar
  1149. ======================
  1150.  
  1151.    In order to specify a toolbar, set one of the variables
  1152. `default-toolbar', `top-toolbar', `bottom-toolbar', `left-toolbar', or
  1153. `right-toolbar'.  These are specifiers, which means you set them with
  1154. `set-specifier' and query them with `specifier-specs' or
  1155. `specifier-instance'.  You will get an error if you try to set them
  1156. using `setq'.  *Note Specifiers:: for more information.
  1157.  
  1158.    Most of the time, you will set `default-toolbar', which allows the
  1159. user to choose where the toolbar should go.
  1160.  
  1161.  - Variable: default-toolbar
  1162.      The position of this toolbar is specified in the function
  1163.      `default-toolbar-position'.  If the corresponding position-
  1164.      specific toolbar (e.g. `top-toolbar' if `default-toolbar-position'
  1165.      is `top') does not specify a toolbar in a particular domain, then
  1166.      the value of `default-toolbar' in that domain, of any, will be
  1167.      used instead.
  1168.  
  1169.    Note that the toolbar at any particular position will not be
  1170. displayed unless its thickness (width or height, depending on
  1171. orientation) is non-zero.  The thickness is controlled by the variables
  1172. `top-toolbar-height', `bottom-toolbar-height', `left-toolbar-width',
  1173. and `right-toolbar-width' (*note Other Toolbar Variables::.).  By
  1174. default, only `top-toolbar-height' has a non-zero value.
  1175.  
  1176.  - Function: set-default-toolbar-position POSITION
  1177.      This function sets the position that the `default-toolbar' will be
  1178.      displayed at.  Valid positions are the symbols `top', `bottom',
  1179.      `left' and `right'.
  1180.  
  1181.  - Function: default-toolbar-position
  1182.      This function return the position that the `default-toolbar' will
  1183.      be displayed at.
  1184.  
  1185.    You can also explicitly set a toolbar at a particular position.  When
  1186. redisplay determines what to display at a particular position in a
  1187. particular domain (i.e. window), it first consults the position-specific
  1188. toolbar.  If that does not yield a toolbar descriptor, the
  1189. `default-toolbar' is consulted if `default-toolbar-position' indicates
  1190. this position.
  1191.  
  1192.  - Variable: top-toolbar
  1193.      Specifier for toolbar at the top of the frame.
  1194.  
  1195.  - Variable: bottom-toolbar
  1196.      Specifier for toolbar at the bottom of the frame.
  1197.  
  1198.  - Variable: left-toolbar
  1199.      Specifier for toolbar at the left edge of the frame.
  1200.  
  1201.  - Variable: right-toolbar
  1202.      Specifier for toolbar at the right edge of the frame.
  1203.  
  1204.  - Function: toolbar-specifier-p OBJECT
  1205.      This function Returns non-nil if OBJECT is an toolbar specifier.
  1206.      Toolbar specifiers are the actual objects contained in the toolbar
  1207.      variables described above.
  1208.  
  1209. 
  1210. File: lispref.info,  Node: Other Toolbar Variables,  Prev: Specifying the Toolbar,  Up: Toolbar
  1211.  
  1212. Other Toolbar Variables
  1213. =======================
  1214.  
  1215.    The variables to control the toolbar height and width are all
  1216. specifiers.  *Note Specifiers::.
  1217.  
  1218.  - Variable: top-toolbar-height
  1219.      Height of top toolbar.
  1220.  
  1221.  - Variable: bottom-toolbar-height
  1222.      Height of bottom toolbar.
  1223.  
  1224.  - Variable: left-toolbar-width
  1225.      Width of left toolbar.
  1226.  
  1227.  - Variable: right-toolbar-width
  1228.      Width of right toolbar.
  1229.  
  1230.    You can also reset the toolbar to what it was when XEmacs started up.
  1231.  
  1232.  - Variable: initial-toolbar-spec
  1233.      The toolbar descriptor used to initialize `default-toolbar' at
  1234.      startup.
  1235.  
  1236. 
  1237. File: lispref.info,  Node: Scrollbars,  Next: Modes,  Prev: Toolbar,  Up: Top
  1238.  
  1239. scrollbars
  1240. **********
  1241.  
  1242.    Not yet documented.
  1243.  
  1244. 
  1245. File: lispref.info,  Node: Modes,  Next: Documentation,  Prev: Scrollbars,  Up: Top
  1246.  
  1247. Major and Minor Modes
  1248. *********************
  1249.  
  1250.    A "mode" is a set of definitions that customize XEmacs and can be
  1251. turned on and off while you edit.  There are two varieties of modes:
  1252. "major modes", which are mutually exclusive and used for editing
  1253. particular kinds of text, and "minor modes", which provide features
  1254. that users can enable individually.
  1255.  
  1256.    This chapter describes how to write both major and minor modes, how
  1257. to indicate them in the modeline, and how they run hooks supplied by the
  1258. user.  For related topics such as keymaps and syntax tables, see *Note
  1259. Keymaps::, and *Note Syntax Tables::.
  1260.  
  1261. * Menu:
  1262.  
  1263. * Major Modes::        Defining major modes.
  1264. * Minor Modes::        Defining minor modes.
  1265. * Modeline Format::    Customizing the text that appears in the modeline.
  1266. * Hooks::              How to use hooks; how to write code that provides hooks.
  1267.  
  1268. 
  1269. File: lispref.info,  Node: Major Modes,  Next: Minor Modes,  Up: Modes
  1270.  
  1271. Major Modes
  1272. ===========
  1273.  
  1274.    Major modes specialize XEmacs for editing particular kinds of text.
  1275. Each buffer has only one major mode at a time.
  1276.  
  1277.    The least specialized major mode is called "Fundamental mode".  This
  1278. mode has no mode-specific definitions or variable settings, so each
  1279. XEmacs command behaves in its default manner, and each option is in its
  1280. default state.  All other major modes redefine various keys and options.
  1281. For example, Lisp Interaction mode provides special key bindings for
  1282. LFD (`eval-print-last-sexp'), TAB (`lisp-indent-line'), and other keys.
  1283.  
  1284.    When you need to write several editing commands to help you perform a
  1285. specialized editing task, creating a new major mode is usually a good
  1286. idea.  In practice, writing a major mode is easy (in contrast to
  1287. writing a minor mode, which is often difficult).
  1288.  
  1289.    If the new mode is similar to an old one, it is often unwise to
  1290. modify the old one to serve two purposes, since it may become harder to
  1291. use and maintain.  Instead, copy and rename an existing major mode
  1292. definition and alter the copy--or define a "derived mode" (*note
  1293. Derived Modes::.).  For example, Rmail Edit mode, which is in
  1294. `emacs/lisp/rmailedit.el', is a major mode that is very similar to Text
  1295. mode except that it provides three additional commands.  Its definition
  1296. is distinct from that of Text mode, but was derived from it.
  1297.  
  1298.    Rmail Edit mode is an example of a case where one piece of text is
  1299. put temporarily into a different major mode so it can be edited in a
  1300. different way (with ordinary XEmacs commands rather than Rmail).  In
  1301. such cases, the temporary major mode usually has a command to switch
  1302. back to the buffer's usual mode (Rmail mode, in this case).  You might
  1303. be tempted to present the temporary redefinitions inside a recursive
  1304. edit and restore the usual ones when the user exits; but this is a bad
  1305. idea because it constrains the user's options when it is done in more
  1306. than one buffer: recursive edits must be exited most-recently-entered
  1307. first.  Using alternative major modes avoids this limitation.  *Note
  1308. Recursive Editing::.
  1309.  
  1310.    The standard XEmacs Lisp library directory contains the code for
  1311. several major modes, in files including `text-mode.el', `texinfo.el',
  1312. `lisp-mode.el', `c-mode.el', and `rmail.el'.  You can look at these
  1313. libraries to see how modes are written.  Text mode is perhaps the
  1314. simplest major mode aside from Fundamental mode.  Rmail mode is a
  1315. complicated and specialized mode.
  1316.  
  1317. * Menu:
  1318.  
  1319. * Major Mode Conventions::  Coding conventions for keymaps, etc.
  1320. * Example Major Modes::     Text mode and Lisp modes.
  1321. * Auto Major Mode::         How XEmacs chooses the major mode automatically.
  1322. * Mode Help::               Finding out how to use a mode.
  1323. * Derived Modes::           Defining a new major mode based on another major
  1324.                               mode.
  1325.  
  1326.